*Replication file 02b_Robustness_Selection_Success
*Article: Counterfactual Coercion: Could harsher sanctions against Russia have prevented the worst?
*Authors: Thies Niemeier, Gerald Schneider


***************************************************************
***EU***
***************************************************************

*Prepare data
use "Dataset.dta", clear
keep if sender=="EU"

** Filter for cases of importance
keep if pot_sanctioned_countries == 1

xtset ccodecow year
gen ln_oil_gas_value_2014 = ln(oil_gas_value_2014+1)
gen sender_colony=0
replace sender_colony=1 if ht_colonial==2 | ht_colonial==3 | ht_colonial==6 | ht_colonial==7 | ht_colonial==8 | ht_colonial==9 | ht_colonial==10

gen sender_additional=cond(threatUS==1 | impositionUS == 1, 1, 0)
gen only_threat=cond(threatEU==1 & impositionEU == 0, 1, 0)

gen sender_trade = ln_EU_Trade_Eurostat
gen coup_dummy = coup1
replace coup_dummy = 0 if coup_dummy == 1
replace coup_dummy = 1 if coup_dummy == 2

* variable which is 1 if a threat or sanction case started in the dyad
replace caseid=0 if caseid==.
gen sanctiononset = (caseid-l.caseid)
replace sanctiononset=1 if sanctiononset > 1 & !missing(sanctiononset)
replace sanctiononset=0 if sanctiononset < 0
replace sanctiononset=. if sanctiononset == 0 & (sanction_dyad == 1 | threat_dyad == 1)
tab sanctiononset
gen sanctiononset_train=sanctiononset if year < 2009
gen sanctiononset_test=sanctiononset if year >= 2009

* include threat intensity into intensity measure
gen intensity = impositionEU_target
replace intensity=threatEU_target if missing(intensity)

* combine intensity 1-2 & 3-5, because almost no cases
*3-4,5
replace intensity=1 if intensity==1 | intensity==2 
replace intensity=2 if intensity==3 | intensity==4 
replace intensity=3 if intensity==5
replace intensity=4 if intensity==6

* Gradualism
gen gradualism = impositionEU_gradualism
replace gradualism=1 if missing(impositionEU_gradualism) & sanctiononset==1

* HSE score
* 6; 12
gen ordsuccess=0 if sanctiononset == 1
replace ordsuccess=1 if HSEscore == 6 | HSEscore == 9
replace ordsuccess=2 if HSEscore == 12 | HSEscore == 16

* create training and test variable
gen ordsuccess_train= ordsuccess*sanctiononset_train
gen ordsuccess_test= ordsuccess*sanctiononset_test

* Selection model
eststo:heckoprobit ordsuccess_train i.intensity L.v2x_polyarchy L.gd_ptss i.L.coup_dummy i.L.one_sided_violence i.L.conflict i.L.mid_terr_integrity L.ln_GDPpc_imputed L.sender_trade L.ln_oil_gas_value_2014 i.L.sender_colony i.L.defense_alliance i.sender_additional i.only_threat gradualism, select(sanctiononset_train = L.v2x_polyarchy L.gd_ptss i.L.mid_terr_integrity L.ln_GDPpc_imputed L.sender_trade i.L.conflict L.ln_oil_gas_value_2014)


***************************************************************
***US***
***************************************************************

*Prepare data
use "Dataset.dta", clear
keep if sender=="US"

** Filter for cases of importance
keep if pot_sanctioned_countries == 1

xtset ccodecow year
gen ln_oil_gas_value_2014 = ln(oil_gas_value_2014+1)
gen sender_colony = 0
replace sender_colony = 1 if ht_colonial == 4

gen sender_additional=cond(threatEU==1 | impositionEU == 1, 1, 0)
gen only_threat=cond(threatUS==1 & impositionUS == 0, 1, 0)

gen sender_trade = ln_US_Trade_COW
gen coup_dummy = coup1
replace coup_dummy = 0 if coup_dummy == 1
replace coup_dummy = 1 if coup_dummy == 2

* variable which is 1 if a threat or sanction case started in the dyad
replace caseid=0 if caseid==.
gen sanctiononset = (caseid-l.caseid)
replace sanctiononset=1 if sanctiononset > 1 & !missing(sanctiononset)
replace sanctiononset=0 if sanctiononset < 0
replace sanctiononset=. if sanctiononset == 0 & (sanction_dyad == 1 | threat_dyad == 1)
tab sanctiononset
gen sanctiononset_train=sanctiononset if year < 2009
gen sanctiononset_test=sanctiononset if year >= 2009

* include threat intensity into intensity measure
gen intensity = impositionUS_target
replace intensity=threatUS_target if missing(intensity)

* combine intensity 1-2 & 3-5, because almost no cases
*3-4,5
replace intensity=1 if intensity==1 | intensity==2 
replace intensity=2 if intensity==3 | intensity==4 
replace intensity=3 if intensity==5
replace intensity=4 if intensity==6

* Gradualism
gen gradualism = impositionUS_gradualism
replace gradualism=1 if missing(impositionUS_gradualism) & sanctiononset==1

* HSE score
* 6; 12
gen ordsuccess=0 if sanctiononset == 1
replace ordsuccess=1 if HSEscore == 6 | HSEscore == 9
replace ordsuccess=2 if HSEscore == 12 | HSEscore == 16

* create training and test variable
gen ordsuccess_train= ordsuccess*sanctiononset_train
gen ordsuccess_test= ordsuccess*sanctiononset_test

* Selection model
eststo:heckoprobit ordsuccess_train i.intensity L.v2x_polyarchy L.gd_ptss i.L.one_sided_violence i.L.conflict i.L.mid_terr_integrity L.ln_GDPpc_imputed L.sender_trade L.ln_oil_gas_value_2014 i.L.defense_alliance i.sender_additional i.only_threat gradualism, select(sanctiononset_train = L.v2x_polyarchy L.ln_GDPpc_imputed L.sender_trade i.L.one_sided_violence i.L.conflict i.L.mid_terr_integrity L.ln_oil_gas_value_2014)

* Give out regression tables for selection
esttab est1 est2 using Supplemental_Material\Regression_Tables\Regressions_Success_Selection.rtf, se scalars(chi2 p ll chi2_c p_c) keep(2.intensity 3.intensity 4.intensity L.v2x_polyarchy L.gd_ptss 1L.coup_dummy 1L.one_sided_violence 1L.conflict 1L.mid_terr_integrity L.ln_GDPpc_imputed L.sender_trade L.ln_oil_gas_value_2014 1L.sender_colony 1L.defense_alliance 1.sender_additional 1.only_threat gradualism) order(2.intensity 3.intensity 4.intensity L.v2x_polyarchy L.gd_ptss 1L.coup_dummy 1L.one_sided_violence 1L.conflict 1L.mid_terr_integrity L.ln_GDPpc_imputed L.sender_trade L.ln_oil_gas_value_2014 1L.defense_alliance 1L.sender_colony 1.only_threat 1.sender_additional intensity gradualism) label legend varlabels(2.intensity Intensity_2 3.intensity Intensity_3 4.intensity Intensity_4 L.v2x_polyarchy Dem._Index L.gd_ptss Pol._Terror_Scale 1L.coup_dummy Mil._Coup 1L.one_sided_violence One-sided_Violence 1L.conflict Armed_Conflict 1L.mid_terr_integrity Terr._Integrity L.ln_GDPpc_imputed GDP_p.c. L.sender_trade Sender_Trade L.ln_oil_gas_value_2014 Target_Oil_Gas_Exports 1L.sender_colony Sender_Colony 1L.defense_alliance Defense_Alliance 1.sender_additional Multilateral_US/EU 1.only_threat Threat gradualism Gradualism sanctiononset_train Sanction_Onset) mtitles("EU" "US") eqlabel(" ") wide star(* 0.10 ** 0.05 ** 0.01)
